<!-- Brother1.svelte -->
<script>
  import { createEventDispatcher } from 'svelte';

  // 从父组件接收共享数据
  export let sharedData;

  const dispatch = createEventDispatcher();

  function updateData() {
    // 向父组件发送事件，更新共享数据
    dispatch('update', 'Data from Brother 1');

    console.log($sharedData)
  }
</script>

<p>Brother 1 Data: {$sharedData.detail}</p>
<button on:click={updateData}>Update from Brother 1</button>
